﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace MJM.RPP.AccesoDatos
{
    public class CamaraAD
    {
        public DataTable Listar()
        {
            SqlConnection conn = new SqlConnection(Cadena.GetCadenaObservatorio());
            SqlCommand cmd = new SqlCommand("sp_s_T_ORGA_UNICAMA_Listar", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            DataTable dt=new DataTable();
            SqlDataAdapter da=new SqlDataAdapter();
            try
            {
                cmd.Parameters.Add(new SqlParameter("@vSEGU_inFLAELI", 1));
                cmd.Parameters.Add(new SqlParameter("@vCAMA_P_inID", DBNull.Value));
                cmd.Connection.Open();
                da.SelectCommand = cmd;
                da.Fill(dt);
                cmd.Connection.Close();
                conn.Dispose();
                cmd.Dispose();
            }
            catch(Exception ex)
            {
                cmd.Dispose();
                conn.Dispose();
            }
            return dt;
        }
    }
}
